from fastapi.routing import APIRoute
from pathlib import Path
from core.registrar import register_app
import uvicorn


def custom_generate_unique_id(route: APIRoute) -> str:
    return f"{route.tags[0]}-{route.name}"


app = register_app()

if __name__ == '__main__':
    try:
        config = uvicorn.Config(app=f'{Path(__file__).stem}:app', reload=False, host='0.0.0.0', port=7000, workers=1)
        server = uvicorn.Server(config)
        server.run()
    except Exception as e:
        raise e
